package com.me.Design;

import java.util.Scanner;

import com.me.common.enums.PeopleType;
import com.me.dao.people.AddressAbstractFactory;
import com.me.dao.util.AbstractFactory;

/**
 * 功能：抽象工厂模式 练习
 * 需要一个对象(people) 具有 A(address) B(peopleDao) 两种属性 两个人 就有两套各自的 A(address) B(peopleDao)
 * 然后通过特定参数(name) 确认是哪一个人 然后新建对应的对象
 * 									→	DbAddressFactory :实现getPeopleDao(),getAddress()
 *
 * 抽象工厂-AddressAbstractFactory : getPeopleDao(),getAddress()
 *
 * 									→ LyAddressFactory  :实现getPeopleDao(),getAddress()
 *
 *
 *
 * @author：dongshibo(F_baisi)
 * @create：2019/1/24/024 15:26
 * @version：2019 Version：1.0
 * @company：老屋新房 Created with IntelliJ IDEA
 */
public class AbstractFacotryDesignTest {

	public static void main(String[] args) {
		//第一次改动
		Scanner scanner = new Scanner(System.in);
		String name = scanner.next();
		AddressAbstractFactory addressAbstractFactory = null;
		switch (PeopleType.getByValue(name)){
			case LIUYANG:
				addressAbstractFactory = AbstractFactory.getLyAddressFactory();
				break;
			case DABIN:
				addressAbstractFactory = AbstractFactory.getDbAddressFactory();
				break;
			default:
				System.out.println("一切都结束了");
				return;
		}
		System.out.println(addressAbstractFactory.getPeopleDao().getPeople());
		addressAbstractFactory.getAddress();
	}
}
